\begin{abstract}
In advent of multicore era, plain C/C++ programming languages cannot
fully reflect computer architectures. Source-to-source
transformations help tailor programs close to contemporary
hardware. In this paper, we propose a template metaprogramming
approach to support parallel programs, which performs
source-to-source transformations for specific
multicores. Our approach is purely library-based, which presents
parallel patterns and execution models as template classes. We have implemented a prototype
template library --- libvina, to demonstrate the idea. Libvina enables
programmers to exploit new architectural
features and to apply new parallel patterns by extending the library. 
We have evaluated our template library on
commodity CPU and GPU platforms with a variety of typical procedures
from multimedia and scientific fields. Our experimental results show that our
approach is flexible to support multiple parallel models and capable
of transforming sequential codes to parallel equivalences for different 
multicore architectures. 
\end{abstract}
